package com.asj.house.controller;


import com.asj.house.returns.RespEntity;
import com.asj.house.service.HouseRoomRecommendService;
import com.asj.house.vo.result.TransferResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 房屋推荐表 前端控制器
 * </p>
 *
 * @author asj
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/house-room-recommend")
@Slf4j
@Api(value = "房源推荐接口", tags = "房源推荐接口")
public class HouseRoomRecommendController {

    @Resource
    private HouseRoomRecommendService houseRoomRecommendService;

    @GetMapping("/list")
    @ApiOperation("获取推荐房源信息")
    public RespEntity<TransferResult> listHouseRecommend() {
        RespEntity<TransferResult> respEntity = houseRoomRecommendService.getRecommendList();
        return respEntity;
    }

    @PutMapping("/update")
    @ApiOperation(value = "编辑房源推荐")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "put", dataType = "String", name = "json", value = "穿梭数据", required = true),
            @ApiImplicitParam(paramType = "put", dataType = "Integer", name = "index", value = "穿梭方向标记", required = true)
    })
    RespEntity updateHouseRoomRecommend(@RequestParam(value = "json", required = true) String json,
                                        @RequestParam(value = "index", required = true) Integer index) {
        RespEntity respEntity = houseRoomRecommendService.updateHouseRoomRecommend(json, index);
        return respEntity;
    }

}
